package com.maychat.pojo;

import com.maychat.enums.ContactType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class ChatSessionUser implements Serializable {

    @Serial
    private static final long serialVersionUID = -6645910492066056409L;
    protected String userId; // user_id
    protected String contactId; // contact_id
    protected String sessionId; // session_id
    protected String contactName; // contact_name
    protected Integer contactType;

    public Integer getContactType() {
        final ContactType type = ContactType.getByPrefix(this.contactId);
        return type == null ? -1 : type.ordinal();
    }
}
